package org.zxstudio.widget;
import java.io.File;

import org.zxstudio.widget.GalleryFlow;
import org.zxstudio.widget.R;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Toast;

/*===============================
 *Title      :  Gallery3DActivity.java
 *Created  :[ 2012-4-20 下午2:49:51 ] by fanlt
 * ==============================
 * Description:   
 * Copyright  :  Copyright (c) 2012
 * Company    :  Flyfot
 * @author  <a href="fanlt@flyfot.cn">fanlt</a>
 *
 */

/**
 * @author fan
 */
public class Gallery3DActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);
        File file = Environment.getExternalStorageDirectory();
        Log.v("fan","file:" + file.getAbsolutePath());
        Log.v("fan","file:" + File.separator);
        Integer[] images = {
                R.drawable.aaaa, R.drawable.bbbb, R.drawable.cccc, R.drawable.dddd,
                R.drawable.eeee, R.drawable.ffff, R.drawable.gggg, R.drawable.hhhh
        };

        ImageAdapter adapter = new ImageAdapter(this, images);
        adapter.createReflectedImages();// 创建倒影效果
        GalleryFlow galleryFlow = (GalleryFlow) this.findViewById(R.id.gallery);
        galleryFlow.setFadingEdgeLength(0);
        galleryFlow.setSpacing(-100); // 图片之间的间距
        galleryFlow.setAdapter(adapter);

        galleryFlow.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
                Toast.makeText(getApplicationContext(), String.valueOf(position),
                        Toast.LENGTH_SHORT).show();
            }

        });
        galleryFlow.setSelection(4);
    }
}
